Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix multipart schema inference for allOf/anyOf/oneOf of primitive types and non-binary arrays #391

Merged

Conversation

czechboy0
Copy link
Contributor

Motivation

As I started testing the multipart generation on real-world projects, I discovered two bugs:

  • allOf/anyOf/oneOf of primitive types (such as string) were encoded as JSON instead of a raw string (aka HTTPBody), which was wrong
  • arrays of non-binary and arrays of binary elements were treated inconsistently

Modifications

Fixed the bug by refactoring the inferrence logic a bit.

Result

Now e.g. an anyOf of a string still gets encoded as a primitive type, not JSON.

Test Plan

Added a unit test for this logic with a few test cases, easier to debug this way.

@czechboy0 czechboy0 added this to the 1.0 milestone Nov 27, 2023
@czechboy0 czechboy0 merged commit e6134b4 into apple:main Nov 27, 2023
8 checks passed
@czechboy0 czechboy0 deleted the hd-multipart-part-schema-inference-bugfix branch November 27, 2023 13:36
@czechboy0 czechboy0 added the ⚠️ semver/major Breaks existing public API. label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ semver/major Breaks existing public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants